﻿using System;
using fastCSharp;
using fastCSharp.code.cSharp;

namespace diantou.web.exam
{
    /// <summary>
    /// 考试邀请用户设置
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsPage = false)]
    partial class invitation : webView.view<invitation>
    {
        /// <summary>
        /// 企业考试邀请
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.examDataAccess.examInvitation user;
        /// <summary>
        /// 企业考试
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.examDataAccess.exam exam;
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private bool loadView(int id, string code)
        {
            user = diantou.examDataAccess.tcpCall.examInvitation.get(id, code);
            if (user != null)
            {
                if (user.UserId == 0)
                {
                    if (user.IsTimeout)
                    {
                        AjaxResponse(webConfig.NotFound404);
                        return false;
                    }
                    exam = diantou.examDataAccess.clientCache.Exam[user.ExamId];
                    SetSession<webConfig.session>(new webConfig.session { Type = webConfig.session.type.ExamInvitation, Id = id });
                    return true;
                }
                location(new diantou.examDataAccess.exam { Id = user.ExamId }.Path.Index, false);
                return false;
            }
            AjaxResponse(webConfig.NotFound404);
            return false;
        }
    }
}
